

********************************************************************************
**********                    Master do-file                      **************
********************************************************************************


* 0. Set Paths
if "`c(username)'" == "felix.montag"{
	global transparency "C:\Users\felix.montag\Dropbox\00_Transparency_project"
	global raw "$transparency\01_raw_data"
	global code "$transparency\02_code"
	global dta "$transparency\03_dta"
	global output "$transparency\04_output"
}
else if "`c(username)'" == "fm2731"{
	global transparency "C:\Users\fm2731\Dropbox\00_Transparency_project"
	global raw "$transparency\01_raw_data"
	global code "$transparency\02_code"
	global dta "$transparency\03_dta"
	global output "$transparency\04_output"
}
else if "`c(username)'" == "felixmontag"{
	global transparency "/Users/felixmontag/Dropbox/00_Transparency_project"
	global raw "$transparency/01_raw_data"
	global code "$transparency/02_code"
	global dta "$transparency/03_dta"
	global output "$transparency/04_output"
}	

* 1. Install packages and set settings
*Type findit lean2 and click through on the install links to install lean2
*ssc install rangejoin
*ssc install gtools
*ssc install rangestat
*ssc install shp2dta
*ssc install spmap
*ssc install geonear
*ssc install geoinpoly
*ssc install distinct
*ssc install listtab
*ssc install sdid
*ssc install texsave
*ssc install coefplot
*ssc install estout
*ssc install reghdfe
*ssc install ftools

* Install and setup osrmtime package (only needed to do once)
*net describe osrmtime, from("$raw\07_Osrm")
*net install osrmtime
*net get osrmtime
*shell osrminstall.cmd

//	Prepare German and French maps
*Download from here if required: https://download.geofabrik.de/europe/germany.html
*Download from here if required: https://download.geofabrik.de/europe/france.html
*osrmprepare , mapfile("$raw\09_France_osrm_map\france-latest.osm.pbf") osrmdir("C:\osrm\") profile(car)
*osrmprepare, mapfile("$raw\06_Germany_osrm_map\germany-latest.osm.pbf") osrmdir("C:\osrm\") profile(car)


clear all
set more off, perm
set maxvar 40000

	//	Set graph Scheme
		set scheme s1color, perm
		set scheme lean2


* 2. Run do-files in their numeric order


* Data Prep

cd "$$code"
do 1_Prices_Germany.do
do 2_20201222_refinery_rotterdam.do
do 3_20180427_Costs.do
do $code\4_20201221_prices_france.do
do $code\5_20180611_distance_to_french_border.do
do $code\6_20190524_Station_Markets_Germany.do
do $code\7_20190524_Station_Markets_France.do
do $code\8_20180305_radio_station_location_data_load.do
do $code\9_20180305_Radio_Reports_Petrol_Prices.do
do $code\10_20180529_Station_panel_radio_treatment.do
do $code\11_build_price_panel.do


* Analysis

do $code\12_Summary_statistic_Table1andB1.do
do $code\13_Search_Figures3to4and6to7_andB7.do
do $code\14_VOI_market_Fig5_Tab3.do
do $code\15_Fig8and10_Tab2andC1toC5.do
do $code\16_Competitors_Table4.do
do $code\17_Radio_treatment_Table5.do
do $code\18_FiguresB1toB6.do
do $code\19_Bulletin_TabC6.do
